<template>
  <el-dropdown @command="changeLanguage">
    <div>
      <svg-icon style="color:#fff;font-size:20px" icon-class="language" />
    </div>
    <el-dropdown-menu>
      <el-dropdown-item command="en" :disabled="'en'=== $i18n.locale ">en</el-dropdown-item>
      <el-dropdown-item command="zh" :disabled="'zh'=== $i18n.locale ">zh</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
import Cookie from 'js-cookie'
export default {
  methods: {
    changeLanguage(lang) {
      Cookie.set('language', lang)
      this.$i18n.locale = lang
      this.$message('语言设置成功')
    }
  }
}
</script>

<style>

</style>
